clear,clc;
x=[0 1 3 4];
y=[0 0 2 2];
y1=interp1(x,y,0.5,'linear');
y2=interp1(x,y,0.5,'spline');
y3=interp1(x,y,0.5,'pchip');
y4=interp1(x,y,0.5,'nearest');